<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%  
response.setHeader("Access-Control-Allow-Origin", "*");  
%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


 

<html>


<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>种子详情·思通投研·让数据驱动投资价值!</title>
	<link href="${pageContext.request.contextPath }/img/webLogoIcon.png" rel="shortcut icon">
    <link href="${pageContext.request.contextPath }/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/font-awesome.css" rel="stylesheet">

    <link href="${pageContext.request.contextPath }/css/animate.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath }/css/style.css" rel="stylesheet">
    



    <!-- FooTable -->
    <link href="${pageContext.request.contextPath }/css/footable.core.css" rel="stylesheet">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.css" rel="stylesheet" />
    <link href="${pageContext.request.contextPath}/css/mypage.css" rel="stylesheet">
    <style>
		.select2_demo_1{
			float: left;
			width: 120px;
			display: inline;
			margin-left: 10px;
		}
		.form-control{
			display: inline;
		}
		
		.col-sm-3{
			float:right;
			width: 560px;
		}
		.input-group{
			float:right;
			width: 240px;
			margin-left: 5px;
		}
	   td{
	        vertical-align:middle;
	    }
	</style>

</head>

<body>

    <div id="wrapper">

        <nav class="navbar-default navbar-static-side" role="navigation">
            <%request.setAttribute("LEFT", "foreignwebsitelist");%>
            <%@include file="left-factory.jsp"%>
        </nav>

        <div id="page-wrapper" class="gray-bg">
        <div class="row border-bottom">
		<jsp:include page="head-factory.jsp" flush="true" />
        </div>
        <div class="row wrapper border-bottom white-bg page-heading">
            <div class="col-lg-9">
                <h2>种子详情</h2>
                <ol class="breadcrumb">
                	<li class="nav-main1">
                		<a href="${pageContext.request.contextPath}/admin/tosystem_overview">主页</a>
                	</li>
                	<li class="nav-main2" >
                		<a id="navigation1" href="${pageContext.request.contextPath}/foreignlistseed?websiteId=${seed.website_id}" >${seed.website_name }</a>
                	</li>
                	<li class="active">
                		<a>${seed.seed_name }</a>
                	</li>
               	</ol>
            </div>
        </div>

        <div class="wrapper wrapper-content animated fadeInRight">
            <div class="row">
                <div class="col-lg-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content">
                            <div class="row">
                                <div class="col-lg-12">
                                    <div class="m-b-md">
                                    	<button class="btn btn-white pull-right" onclick="window.location.href='${pageContext.request.contextPath}/foreignlistseed?websiteId=${seed.website_id }';" type="button" style="margin-left: 2%;">返回</button>
                                        <!-- 此功能暂未实现 -->
                                        <!-- <a href="#" class="btn btn-white pull-right">编辑种子</a> -->
                                        <h2 id="seedId" data-id="${seed.id }" data-websiteId="${seed.website_id }" style="display: inline;">${seed.seed_name }</h2>
                                        <a style=" margin: 1em 2em;color: inherit;" onclick="window.location.href = '${pageContext.request.contextPath}/getforeignseedconfig?seedid=${seed.id }'"><i class="fa fa-edit"></i>&nbsp;编辑</a>
                                    </div>
                                </div>
                            </div>
                            <div class="row" style="font-size: 16px;margin-top: 2%;">
                                <div class="col-lg-5">
                                    <dl class="dl-horizontal">
                                    	<dt>状态:</dt>
                                    	<dd>
	                                    	<c:if test="${seed.seed_status == 0 }">
	                                    		<span style="line-height: 2;" class="label label-danger">已关闭</span>
	                                    	</c:if>
	                                    	<c:if test="${seed.seed_status == 1 }">
	                                    		<span style="line-height: 2;" class="label label-primary">运行中</span>
	                                    	</c:if>
                                    	</dd>
                                    	<c:set var="seed_datestr" value="${seed.create_date}" />
										<c:set var="seed_create_date" value="${fn:substring(seed_datestr, 0, 19)}" />
                                        <dt>创建时间:</dt> <dd> ${seed_create_date }</dd>
                                    </dl>
                                </div>
                                <div class="col-lg-7" id="cluster_info">
                                    <dl class="dl-horizontal" >

                                        <dt>今日采集量:</dt> <dd><fmt:formatNumber	type="number" value="${todaynum }"
										 />条</dd>
                                        <dt>总计采集量:</dt> <dd><fmt:formatNumber	type="number" value="${totalnum }"
										 />条</dd>
                                    </dl>
                                </div>
                            </div>
                            <div class="row m-t-sm">
                                <div class="col-lg-12">
                                <div class="panel blank-panel">
                                <div class="panel-heading">
                                    <div class="panel-options">
                                        <ul class="nav nav-tabs">
                                            <li class="active"><a href="#tab-1" data-toggle="tab">文章列表</a></li>
                                            <li class=""><a href="#tab-2" data-toggle="tab">运行日志</a></li>
                                        </ul>
                                    </div>
                                </div>

                                <div class="panel-body">

                                <div class="tab-content">
                                <div class="tab-pane active" id="tab-1">
                                    <div class="feed-activity-list">
                                    <c:if test="${list.pages>0}">
                                    <c:forEach items="${list.list }" var="news">
                                        <div class="feed-element">
                                           <div class="search-result">
                                           		<h3>
                                           			<a target="_blank" href="${news.source_url }">${news.title }</a>
<!--                                            			<span class="label" style="float: right; margin-right: 30px; background-color: rgb(197, 209, 6); color: rgb(255, 255, 255);">中性</span>
 -->                                           		</h3>
                                           		<br />
                                           		<c:set var="contentstr" value="${news.content }"/>
												<c:set var="content" value="${fn:substring(contentstr, 0, 200)}" />
                                           		<p>${content}...</p>
                                           		<p>
                                           			<span>来源:${news.source_name} </span>
                                           			<c:set var="timestr" value="${news.publish_time }"/>
													<c:set var="publish_time" value="${fn:substring(timestr, 0, 19)}" />
                                           			<span style="float: right; margin-right: 30px;">时间:${publish_time }</span>
                                           		</p>
                                           </div>
                                        </div>
                                        </c:forEach>
											<div class="box" id="box" style="float: right;"></div>
										</c:if>
                                    </div>
									
                                </div>
                                
                                <div class="tab-pane" id="tab-2">
                                    <div class="feed-activity-list" id="logs">
                                    	
                                    </div>
                                </div>
                                
                                </div>

                                </div>

                                </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
        </div>
        </div>
		<jsp:include page="footer.jsp" flush="true" />
        </div>
        </div>


    <!-- Mainly scripts -->
    <script src="${pageContext.request.contextPath }/js/jquery-2.1.1.js"></script>
    <script src="${pageContext.request.contextPath }/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.metisMenu.js"></script>
    <script src="${pageContext.request.contextPath }/js/jquery.slimscroll.min.js"></script>

    <!-- Custom and plugin javascript -->
    <script src="${pageContext.request.contextPath }/js/inspinia.js"></script>
    <script src="${pageContext.request.contextPath }/js/pace.min.js"></script>
    


    <!-- FooTable -->
    <script src="${pageContext.request.contextPath }/js/footable.all.min.js"></script>
	<script src="${pageContext.request.contextPath}/js/mypage.js"></script>
    <!-- Page-Level Scripts -->
    <script>
        $(document).ready(function() {

            $('.footable').footable();
            aaaa();
        });
        $(function(){
        	
        	if('${list.pages }'>0){
			paging(1,'${list.pages }','${list.pageNum }');
        	}
		});
        function paging(totalData,totalPage, pagenum) {
			$('#box').paging({
				initPageNo : pagenum, // 初始页码
				totalPages : totalPage, //总页数
				totalCount : '合计' + totalData + '条数据', // 条目总数
				slideSpeed : 600, // 缓动速度 单位毫秒
				jump : true, //是否支持跳转
				callback : function(page) {
					// 回调函数
				}
			});
		}

		function JumpToPage(pagenum) {
			var id = $("#seedId").attr("data-id");
			var websiteId = $("#seedId").attr("data-websiteId");
			window.location.href = "${pageContext.request.contextPath}/getseeddetail?seedid="
					+id +"&pageNum=" + pagenum + "&websiteId=" + websiteId;
		}
		function aaaa(){
// 			alert("aaaaaaaa")
        	$.ajax({
        		url : "${pageContext.request.contextPath}/screen/searchArticle",
        		type : "post",
        		data:{
        			spider_seed_id : $("#seedId").attr("data-id")
        		},
        		success : function(res) {
//         			res=res[0]
// 				console.log(res)
				var data = res.data.list;
        			if(data.length > 0){
        				var html = ""
        				for(var i=0 ;i<data.length;i++){
        					var art= data[i]
        					html += "<div class='feed-element'>"+
                            "<div class='search-result'>"+
                       		"<h3><a href='"+art.source_url+"' target='_blank'>"+art.title+"</a></h3>"+
                       		"<br />"+
                       		"<p>"+art.content+"</p>"+
                       		"<p>"+
                       			"<span style='float: right; margin-right: 30px;''>时间:"+art.publish_time+"</span>"+
                       		"</p>"+
                       "</div>"+
                    "</div>"
        				}
        				html +="<div class='box' id='logsbox' style='float: right;''></div>"
        				$("#logs").html(html);
//         				console.log(res.data.pageNum)
//         				console.log(res.data.pages)
//         				console.log(res.data.total)
        				$('#logsbox').paging({
        					initPageNo : res.data.pageNum, // 初始页码
        					totalPages : res.data.pages, //总页数
        					totalCount : '合计' + res.data.total + '条数据', // 条目总数
        					slideSpeed : 600, // 缓动速度 单位毫秒
        					jump : true, //是否支持跳转
        					callback : function(page) {
        						// 回调函数
//         						console.log(page);
//         						alert("aaaa")
        					}
        				});
        			}else{
        				$("#logs").html("<div class='feed-element' ><h3>暂无数据</h3></div>");
        			}
        		},
        		error : function(e) {
        			 alert("出错");
        			window.clearInterval(timer);
        		}
        	});
        }
		
		
		//跑马灯方法 
// 		 function init(){
// 			    //获取标题
// 			    var title=document.title;
// 			    //分割字符串--->字符数组
// 			    var arr=title.split("");
// 			    //删除第一个元素并返回该元素
// 			    var e=arr.shift();
// 			    //把一个对象添加到数组末尾
// 			    arr.push(e);
// 			    //把数组转换成字符串
// 			    var marquee=arr.join("");
// 			    //返回给浏览器
// 			    document.title=marquee;
// 			    //定时一直执行
// 			    window.setTimeout("init()",1000);
// 			}
// 			window.onload=init;
		 
		
    </script>

	<script src="https://cdnjs.cloudflare.com/ajax/libs/toastr.js/latest/toastr.min.js"></script>


</body>

</html>
